package com.wpen.unit.web.controller.system;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wpen.unit.service.system.DictionaryService;
import com.wpen.unit.web.dto.system.DictionaryAddRequest;
import com.wpen.unit.web.dto.system.DictionaryAddResponse;
import com.wpen.unit.web.dto.system.DictionaryListRequest;
import com.wpen.unit.web.dto.system.DictionaryListResponse;
import com.wpen.unit.web.dto.system.DictionaryModRequest;
import com.wpen.unit.web.dto.system.DictionaryModResponse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

/**
 * 系统数据字典维护
 * 
 * @author pg
 *
 */
@Tag(name = "系统数据字典模块服务接口")
@RestController
@RequestMapping("/api")
public class DictionaryController {
    @Autowired
    private DictionaryService dictionaryService;

    @Operation(summary = "系统数据字典-列表查询")
    @PostMapping(value = "/dictionary/list",produces = MediaType.APPLICATION_JSON_VALUE)
    public DictionaryListResponse queryListDictionary(@RequestBody @Valid DictionaryListRequest dictionaryListRequest ) {
        return dictionaryService.queryListDictionary(dictionaryListRequest);
    }

    @Operation(summary = "系统数据字典-新增")
    @PostMapping(value = "/dictionary/add",produces = MediaType.APPLICATION_JSON_VALUE)
    public DictionaryAddResponse addDictionary(@RequestBody @Valid DictionaryAddRequest dictionaryAddRequest ) {
        return dictionaryService.addDictionary(dictionaryAddRequest);
    }


    @Operation(summary = "系统数据字典-修改")
    @PostMapping(value = "/dictionary/mod",produces = MediaType.APPLICATION_JSON_VALUE)
    public DictionaryModResponse modDictionary(@RequestBody @Valid DictionaryModRequest dictionaryModRequest ) {
        return dictionaryService.modDictionary(dictionaryModRequest);
    }


}
